package communication;

import utils.Date;
import business.AddressBusiness;
import business.ClassroomBusiness;
import business.FrequencyBusiness;
import business.MemberBusiness;
import business.VisitantBusiness;
import classes.Address;
import classes.City;
import classes.Classroom;
import classes.District;
import classes.Frequency;
import classes.Iterator;
import classes.Member;
import classes.Visitant;
import exceptions.RepositoryException;

public class Facade
{
	private AddressBusiness		addressBusiness;
	private ClassroomBusiness	classroomBusiness;
	private FrequencyBusiness	frequencyBusiness;
	private MemberBusiness		memberBusiness;
	//private ReportBusiness		reportBusiness;
	private VisitantBusiness	visitantBusiness;

	public Facade() throws RepositoryException
	{
		this.addressBusiness = new AddressBusiness();
		this.classroomBusiness = new ClassroomBusiness();
		this.frequencyBusiness = new FrequencyBusiness();
		this.memberBusiness = new MemberBusiness();
		//this.reportBusiness = new ReportBusiness();
		this.visitantBusiness = new VisitantBusiness();
	}
	
	public void addAddress( Address address ) throws RepositoryException
	{
		addressBusiness.add( address );
	}
	
	public void editAddress( Address address ) throws RepositoryException
	{
		addressBusiness.edit( address );
	}
	
	public Iterator< Address > findAddress( Address address ) throws RepositoryException  
	{
		return addressBusiness.find( address );
	}
	
	public Iterator< District > findDistrict( District district ) throws RepositoryException
	{
		return addressBusiness.findDistrict( district );
	}
	
	public int findId( Address address ) throws RepositoryException
	{
		return addressBusiness.findId( address );
	}
	
	public Address getAddress( int id ) throws RepositoryException
	{
		return addressBusiness.get( id );
	}
	
	public Iterator< Address > getIteratorAddress() throws RepositoryException
	{
		return addressBusiness.getIterator();
	}
	
	public Iterator< City > getIteratorCity() throws RepositoryException
	{
		return addressBusiness.getCityIterator();
	}
	
	public void removeAddress( int id ) throws RepositoryException
	{
		addressBusiness.remove( id );
	}
	
	public int sizeAddress() throws RepositoryException
	{
		return addressBusiness.size();
	}
	
	public void addClassroom( Classroom classroom ) throws RepositoryException
	{
		classroomBusiness.add( classroom );
	}
	
	public void editClassroom( Classroom classroom ) throws RepositoryException
	{
		classroomBusiness.edit( classroom );
	}
	
	public Iterator< Classroom > findClassroom( Classroom classroom ) throws RepositoryException  
	{
		return classroomBusiness.find( classroom );
	}
	
	public Classroom getClassroom( int id ) throws RepositoryException
	{
		return classroomBusiness.get( id );
	}
	
	public Iterator< Classroom > getIteratorClassroom() throws RepositoryException
	{
		return classroomBusiness.getIterator();
	}
	
	public void removeClassroom( int id ) throws RepositoryException
	{
		classroomBusiness.remove( id );
	}
	
	public int sizeClassroom() throws RepositoryException
	{
		return classroomBusiness.size();
	}
	
	public void addFrequency( Frequency frequency ) throws RepositoryException
	{
		frequencyBusiness.add( frequency );
	}
	
	public void editFrequency( Frequency frequency ) throws RepositoryException
	{
		frequencyBusiness.edit( frequency );
	}
	
	public Iterator< Frequency > findFrequency( Frequency frequency ) throws RepositoryException  
	{
		return frequencyBusiness.find( frequency );
	}
	
	public Frequency getFrequency( int id ) throws RepositoryException
	{
		return frequencyBusiness.get( id );
	}
	
	public Iterator< Frequency > getIteratorFrequency() throws RepositoryException
	{
		return frequencyBusiness.getIterator();
	}
	
	public void removeFrequency( int id ) throws RepositoryException
	{
		frequencyBusiness.remove( id );
	}
	
	public int sizeFrequency() throws RepositoryException
	{
		return frequencyBusiness.size();
	}
	
 	public void addMember( Member member ) throws RepositoryException
	{
		memberBusiness.add( member );
	}
	
	public void editMember( Member member ) throws RepositoryException
	{
		memberBusiness.edit( member );
	}
	
	public Member getMember( int id ) throws RepositoryException
	{
		return memberBusiness.get( id );
	}
	
	public Iterator< Member > getIteratorMember( Date startDate, Date endDate ) throws RepositoryException
	{
		return memberBusiness.getIterator( startDate, endDate );
	}
	
	public Iterator< Member > getIteratorMember() throws RepositoryException
	{
		return memberBusiness.getIterator();
	}
	
	public void removeMember( int id ) throws RepositoryException
	{
		memberBusiness.remove( id );
	}
	
	public int sizeMember() throws RepositoryException
	{
		return memberBusiness.size();
	}
	
	public void addVisitant( Visitant visitant ) throws RepositoryException
	{
		visitantBusiness.add( visitant );
	}
	
	public void editVisitant( Visitant visitant ) throws RepositoryException
	{
		visitantBusiness.edit( visitant );
	}
	
	public Iterator< Visitant > findVisitant( Visitant visitant ) throws RepositoryException  
	{
		return visitantBusiness.find( visitant );
	}
	
	public Visitant getVisitant( int id ) throws RepositoryException
	{
		return visitantBusiness.get( id );
	}
	
	public Iterator< Visitant > getIteratorVisitant() throws RepositoryException
	{
		return visitantBusiness.getIterator();
	}
	
	public void removeVisitant( int id ) throws RepositoryException
	{
		visitantBusiness.remove( id );
	}
	
	public int sizeVisitant() throws RepositoryException
	{
		return visitantBusiness.size();
	}
}
